package mao.leetcode.offer;

import java.util.LinkedList;

/**
 * @author Totoro
 * @date 2020/5/27
 * @explain:
 */
class CQueue {
    private LinkedList<Integer> tail;
    private LinkedList<Integer> head;

    public CQueue() {
        tail=new LinkedList<>();
        head=new LinkedList<>();

    }

    public void appendTail(int value) {
        tail.push(value);
    }

    public int deleteHead() {
        if(head.isEmpty()){
            while(!tail.isEmpty()){
                head.push(tail.pop());
            }
        }
        if(!head.isEmpty())
            return head.pop();
        else
            return -1;
    }
}
